package com.zhejiangzhengyuan.municipal_manhole_cover.controller;

import com.zhejiangzhengyuan.municipal_common.annotation.AuthorizationLess;
import com.zhejiangzhengyuan.municipal_common.service.ManholeCoverApplicationService;
import com.zhejiangzhengyuan.municipal_common.utils.ConstantUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/** @author lin_ju Create on 2019/11/25 description: 测试井盖物联网数据 */
@RestController
@Api(tags = "测试井盖物联网数据")
@RequestMapping("/cover/monitorDevice")
public class MonitorDeviceController {
  @Autowired private ManholeCoverApplicationService applicationService;
  private String DeviceType = ConstantUtil.DEVICE_TYPE.MANHOLE_COVER;
@AuthorizationLess
  @ApiOperation(value = "收取井盖设备指令集")
  @RequestMapping(value = "/operationResult", method = RequestMethod.POST)
  public void operationResult(HttpServletRequest request) throws Exception {
    applicationService.fromDeviceResult(request, DeviceType);
  }
  @AuthorizationLess
  @ApiOperation(value = "井盖物联网设备检测是否上线")
  @RequestMapping(value = "/isOnline", method = RequestMethod.POST)
  public void isOnline(HttpServletRequest request) throws Exception {
    applicationService.isOnline(request, DeviceType);
  }
}
